public class PrintNumThread extends Thread {
    @Override
    public void run() {

        try {
            sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        synchronized (Main.class) {
            for (int i = 1; i < 53; i++) {
                System.out.print(i);
                if (i % 2 == 0) {
                    Main.class.notify();
                    try {
                        Main.class.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
